
Ban Doga
|
Posted - 2011.02.11 08:11:00 -
[1]
Edited by: Ban Doga on 11/02/2011 08:11:57
Originally by: Herr Nerdstrom
Originally by: Dr Sheepbringer
Originally by: Herr Nerdstrom It's frightening to me how much obviously bad code still exists in the codebase...
It's better that it's bad code...otherwise one couldn't improve. Imagine if everything was running perfectly and we would still have these problems....
As for bad code/products etc. it's always like that. Thing change, priorities change and people just learn stuff on the go. At least when I look at my old stuff I instantly think "some drunken ******ed monkey had to do this...oh wait, it was me!" and I KNOW I was good.
I'm off to tackle a "bad code" (bad thought more likely) beast...
Good point, there is room for improvement. Along these lines, it sounds like missiles are being treated as first class objects in the server code. Why is this? Do missiles do AOE damage to nearby targets (aside from defenders)? Perhaps I am not understanding the missile mechanics very well, but the impression I get from the game play is that they are targeted (unlike bombs). IF that is the case, why does the code need to consider collisions in 3-space? Missiles could then be reduced in class, reducing overhead of transferring objects in memory and in the calculations needed to process them -- the rest would be like a regular optimistic distributed simulation, just let the clients draw the collisions however they want.
I guess this difference comes from the fact that missiles don't do damage instantly. Like drones they need to traverse a distance, move across the grid, be restricted by a certain acceleration, turning rate and velocity and then inflict their damage when they reached a certain point.
Since this does take time, there must be something that keeps track of where the missile is, if it has reached its destination and where it is moving now, so that the server and all clients can agree on whether the missile did apply damage, is still capable of applying damage and so on.
There's also the point that missiles can be destroyed by Defenders, so you have one thing trying to produce a collision with another.
All this pretty much requires you to have an object you can use to hold all this information. I don't know if you could get away with making it a "non-physical" object, but you still need to keep track of missiles one way or the other.
|